
Namespace StringFormatting

    ''' <summary>
    ''' Maintains character casing rules for a business object.
    ''' </summary>
    Public Class CharacterCasingRulesManager

#Region " Declarations "

        Private _objCharacterCasingRulesList As Dictionary(Of String, CharacterCasing)

#End Region

#Region " Properties "

        ''' <summary>
        ''' Gets RulesDictionary that contains all defined rules for this object.
        ''' </summary>
        Public ReadOnly Property RulesDictionary() As Dictionary(Of String, CharacterCasing)
            Get

                If _objCharacterCasingRulesList Is Nothing Then
                    _objCharacterCasingRulesList = New Dictionary(Of String, CharacterCasing)
                End If

                Return _objCharacterCasingRulesList
            End Get
        End Property

#End Region

#Region " Constructors "

        Public Sub New()
        End Sub

#End Region

#Region " Methods "

        ''' <summary>
        ''' Adds a CharacterCasing Formatting rule to the list of rules to be executed when the property is changed.
        ''' </summary>
        Public Sub AddRule(ByVal strPropertyName As String, ByVal enumCharacterCasing As CharacterCasing)
            Me.RulesDictionary.Add(strPropertyName, enumCharacterCasing)
        End Sub

        ''' <summary>
        ''' Returns the CharacterCasing rule for a property.
        ''' </summary>
        Public Function GetRuleForProperty(ByVal strPropertyName As String) As CharacterCasing

            If RulesDictionary.ContainsKey(strPropertyName) Then
                Return RulesDictionary.Item(strPropertyName)

            Else
                Return CharacterCasing.None
            End If

        End Function

#End Region

    End Class

End Namespace
